import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';

@Injectable()
export class GoodsImageService {
    constructor(@InjectModel('GoodsImage') private readonly goodsImageModel) {}
    async find(where = {}, fields = null) {
        return await this.goodsImageModel.find(where, fields).sort({ sort: 1 });
    }
    async create(goodsImageInfo) {
        return await this.goodsImageModel.create(goodsImageInfo);
    }
    async update(goodsImageInfo) {
        return await this.goodsImageModel.updateOne({ _id: goodsImageInfo._id }, goodsImageInfo);
    }
    async delete(goodsImageInfo) {
        return await this.goodsImageModel.deleteOne(goodsImageInfo);
    }
    getModel() {
        return this.goodsImageModel;
    }
}
